﻿#ifndef FFMPEGVIDEOPLAYER_H
#define FFMPEGVIDEOPLAYER_H

#include <QWidget>
#include "src/videoPlayer.h"

QT_BEGIN_NAMESPACE
namespace Ui { class ffmpegVideoPlayer; }
QT_END_NAMESPACE

class ffmpegVideoPlayer : public QWidget
{
    Q_OBJECT

public:
    ffmpegVideoPlayer(QWidget *parent = nullptr);
    ~ffmpegVideoPlayer();


private slots:
    void on_tBtn_loadVideoFile_clicked();

    void on_tBtn_startPlay_clicked(bool checked);
public slots:
    void revThreadStartSuccessSlot(quint64 videoAllTime); //暂时用来获取视频总时间

    void revUpdatePlayTimeToUISlot(quint64 playTime, quint64 videoAllTime);

    void revUpdatePlayImgToUISlot(QImage img);

    void revFinishedVideoPlaySlot();

    void revFinishedVideoPlayThreadSlot();

protected:
    void resizeEvent(QResizeEvent *event); //窗口大小变化事件
    void closeEvent(QCloseEvent *event); //窗口关闭
    bool eventFilter(QObject *obj, QEvent *event);
public:
    QString filename;
private:
    Ui::ffmpegVideoPlayer *ui;
    videoPlayer player;
    quint64 videoAllTime;
};

#endif // FFMPEGVIDEOPLAYER_H
